package org.logstashplugins.ScheduleConfig;

import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * 定时任务执行器
 */
public class ScheduleExecutor {

    private static ScheduledThreadPoolExecutor executor;

    static {
        executor = new ScheduledThreadPoolExecutor(2);
    }


    public static void putScheduleTask(ScheduleTask task, int delay, int internal, TimeUnit unit){
        executor.scheduleAtFixedRate(task, delay, internal, unit);
    }

}
